<script type="text/javascript">
	jQuery(function($){
		$('.launcher-popover').popover({placement:'bottom'});
	});
</script>
<h2><?php echo __('Infopáginas');?></h2>

<p><?php echo $this->Html->link(__('Nova infopágina'), array('action' => 'add'), array('class'=>'btn btn-primary')); ?>
	<?php echo $this->Html->link(__('O que é página inicial?'), '#', array(
				'class'=>'btn btn-info launcher-popover',
				'data-content'=>__("Página inicial é a página de apresentação do evento, que o usuário terá acesso ao clicar no ícone de casa do menu superior"),
				'data-original-title'=>__('O que é página inicial?')
			)); ?>
</p>

<table cellpadding="0" cellspacing="0" class="table table-striped table-bordered table-hover">
<thead>
<tr>
	<th><?php echo $this->Paginator->sort('nome_pagina', 'Nome da página'); ?></th>
	<th><?php echo $this->Paginator->sort('texto'); ?></th>
	<th>Link</th>
	<th>Menu Superior(Ordem)</th>
	<th>Menu Mais(Ordem)</th>
	<th class="actions"><?php echo __('Actions'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($pages as $page): ?>
<tr>
	<td><?php echo h($page['Userpage']['caminho']); ?>&nbsp;</td>
	<td><?php echo h($page['Userpage']['descricao']); ?>&nbsp;</td>
	<td><?php echo $this->Html->url(array('controller'=>'userpages', 'action'=>'view', $page['Userpage']['caminho']), true) ?>&nbsp;</td>
	<td><?php echo h(($page['Userpage']['menu'])?'SIM ('.$page['Userpage']['ordem_menu'].')':'NÃO')?>
	<td><?php echo h(($page['Userpage']['menu_mais'])?'SIM ('.$page['Userpage']['ordem_menu_mais'].')':'NÃO')?>
	<td class="actions">
		<div class="btn-toolbar">
			  <div class="btn-group">
			  <?php if($page['Userpage']['home']){?>
			  	<?php echo $this->Html->link('<i class="icon-home"></i>', array('action' => 'set_home', $page['Userpage']['id']), array('class'=>'btn active', 'escape'=>false, 'title'=>__('Desmarcar como página inicial'))); ?>
			  <?php }else{?>
			  	<?php echo $this->Html->link('<i class="icon-home"></i>', array('action' => 'set_home', $page['Userpage']['id']), array('class'=>'btn', 'escape'=>false, 'title'=>__('Marcar como página inicial'))); ?>
			  <?php }?>
			  	<?php echo $this->Html->link('<i class="icon-list-alt"></i>', array('action' => 'view', $page['Userpage']['caminho']), array('class'=>'btn', 'escape'=>false, 'title'=>__('Ver'), 'target'=>'_blank')); ?>
			    <?php echo $this->Html->link('<i class="icon-edit"></i>', array('action' => 'edit', $page['Userpage']['id']), array('class'=>'btn', 'title'=>__('Alterar'), 'escape'=>false)); ?>
			    <?php echo $this->Form->postLink('<i class="icon-trash"></i>', array('action' => 'delete', $page['Userpage']['id']), array('class'=>'btn', 'escape'=>false, 'title'=>__('Apagar')), __('Are you sure you want to delete # %s?', $page['Userpage']['id'])); ?>
			  </div>
		</div>
	</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<p class="text-info">
<?php
echo $this->Paginator->counter(array(
'format' => __('Página {:page} de {:pages}, total de {:count} registros')
));
?>	</p>
<div class="pagination pagination-centered">
	<ul>
		<?php echo $this->Paginator->prev(
			'< '.__('Anterior'),
			array('tag' => 'li', 'class' => 'prev'),
			'<a>< '.__('Anterior').'</a>',
			array('tag' => 'li', 'escape' => false, 'class' => 'prev disabled')
		);?>
		<?php echo $this->Paginator->numbers(array('separator' => '', 'tag'=>'li', 'currentTag'=>'a', 'currentClass'=>'active')); ?>
		<?php echo $this->Paginator->next(
			__('Próximo'). ' >',
			array('tag' => 'li', 'class' => 'prev'),
			'<a>'.__('Próximo').' ></a>',
			array('tag' => 'li', 'escape' => false, 'class' => 'prev disabled')
		);?>
	</ul>
</div>